<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="org.apache.catalina.tribes.util.TcclThreadFactory"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date" %>
<%@page import="java.sql.*" %>
<%@page import="org.edu.system.DBConnect" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div id="header">
<table border="0" width="100%" frame="below">
	<tr>
		<td width="80%" height="50px" style="padding-top:10px"><h1>教师教务管理系统</h1></td>
		<td width="20%" style="text-align:right">您好啊，吴彦祖</td>
	</tr>
	<tr height="20px">
		<td>
			<table border="0" frame="hsides">
				<tr>
					<td width="80px">学生考勤</td>
					<td width="80px">成绩管理</td>
					<td width="80px">查看评教</td>
				</tr>
			</table>
		</td>
		<td  style="text-align:right">个人信息</td>
	</tr>
</table>
</div>
<br>
<body>
<%
	String adm_id = (String) (session.getAttribute("UserName"));
	String sql = "SELECT * FROM administrator WHERE adm_id = '" + adm_id + "'";
	System.out.println(sql);
	Connection con = DBConnect.getCon();
	Statement stmt = null;
	ResultSet rs = null;
	stmt = con.createStatement();
	rs = stmt.executeQuery(sql);//执行命令
	if (rs.next())// 如果记录集非空，表明有匹配的用户ID
	{
		//正常进行
	} else {
		// 否则登录失败
		// response.sendRedirect ( "MyJsp.jsp" );
		//response.sendRedirect("login_failure.jsp");
	}
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
#Container {
	width: 100%;
	height: 100%;
	margin: 0px auto;
}

#function {
	float: left;
	width: 120px;
	height: 620px:
}

#deal {
	float: left;
	width: 83%;
	height:650px;
}

#info {
	width: 100%;
	height: 30px;
	clear:both
	
}
</style>
</head>
<body>
	<form method="get" name="frmLogin" >
		<div id="Container">
			<div id="edit">
				<div id="function">
				</div>
				<div id="deal">
					<%
					PreparedStatement pst = null;
					ResultSet rs1 = null;
					try{
						String sql_select = "SELECT * FROM evaluation";
						Connection con1 = DBConnect.getCon();
						request.setCharacterEncoding("utf-8");
						System.out.println(sql_select);
						pst = con1.prepareStatement(sql_select);
						rs1 = pst.executeQuery();
						System.out.println(pst);
						System.out.println(rs1);
					%>
					<table border=“1”>
						<tr>
							<td><font size="2">评价ID</font></td>
							<td><font size="2">课程ID</font></td>
							<td colspan="2" align="center"><font size="2">数据操作</font></td>
						</tr>
						<%
							while(rs1.next()){
								System.out.println(rs1.getString("id"));
						%>
						<tr>
							<td><font size="2"><%= rs1.getString("id") %></font></td>
							<td><font size="2"><%= rs1.getString("lesson_id") %></font></td>
							<td>
							<input type="button"  class="blue_btn" value="查看评价"  onclick="javawwscript:if(confirm('确认查看评教？')){location='teacher_evaluation.jsp?id=<%=rs1.getString("id")%>'}"/>
								
							</td>
						</tr>
						<%
								}
							} catch (Exception e) {
								out.println(e);
							}
						%>
					</table>
				</div>
			</div>
			<div id="info">
				<%
					session.setMaxInactiveInterval(360);//设置session五分钟销毁
					String strDateFormat = "yyyy-MM-dd HH:mm:ss";
					SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
					Date d = new Date(session.getCreationTime());
					String username = (String) session.getAttribute("UserName");
				%>
				<br>用户登录时间：<%=sdf.format(d)%>
				<br>用户名称：<%=username%>
				<br>session ID：<%=session.getId()%>
			</div>
		</div>
	</form>
</body>
</html>